#include <windows.h>

HWND myCreateStatic(HWND hwnd, int id, char* s, int x, int y, int width, int height)
// Creates a static text box.
// hwnd is the window within which the box appears,
// id is a user-provided ID number,
// x,y = position on screen,
// width, height = width and height of the box.
{  HWND h;

   h = CreateWindowEx(WS_EX_STATICEDGE, "STATIC", 
       s,
       WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX,
       x,y,width,height,
       hwnd, 
       (HMENU) id, 
       GetModuleHandle(NULL), NULL);

   if (h) // successful creation
   {  HFONT hfDefault;
      hfDefault = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
      SendMessage(h, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
   }
   else
      MessageBox(hwnd, "MyCreateStatic could not create static text.", 
                 "Error", MB_OK | MB_ICONERROR);

   return h;
}